﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TestGame {
    /// <summary>
    /// A MultiplayerMenuScreen is used to determine what kind of connection
    /// scheme the user will have in order to connect to another player. 
    /// </summary>
    class MultiplayerMenuScreen : MenuScreen {
        #region Fields

        MenuEntry peerEntry;
        MenuEntry serverEntry;
        MenuEntry customServer;
        MenuEntry backEntry;

        #endregion

        #region Constructor

        /// <summary>
        /// Constructs a MultiplayerMenuScreen.
        /// </summary>
        public MultiplayerMenuScreen() : base("Multiplayer") {
            peerEntry = new MenuEntry("Peer Session");
            serverEntry = new MenuEntry("Server Session");
            customServer = new MenuEntry("Custom Server");
            backEntry = new MenuEntry("Back");

            peerEntry.Selected += OnPeerSelected;
            serverEntry.Selected += OnServerSelected;
            customServer.Selected += OnCustomSelected;
            backEntry.Selected += OnCancel;

            MenuEntries.Add(peerEntry);
            MenuEntries.Add(serverEntry);
            MenuEntries.Add(customServer);
            MenuEntries.Add(backEntry);
        }

        #endregion

        #region Event Handlers

        /// <summary>
        /// Is called when the "Peer Session" menu entry is selected.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void OnPeerSelected(object sender, PlayerIndexEventArgs e) {
            PeerSessionScreen screen = new PeerSessionScreen();

            ScreenManager.AddScreen(screen, ControllingPlayer);
        }

        /// <summary>
        /// Is called when the "Server Session" menu entry is selected.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void OnServerSelected(object sender, PlayerIndexEventArgs e) {
            
        }

        /// <summary>
        /// Is called when the "Custom Session" menu entry is selected.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void OnCustomSelected(object sender, PlayerIndexEventArgs e) {

        }
        
        #endregion
    }
}
